<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>清除浮动影响</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        .box, .box1{
            width: 800px;
            height: 80px;
            border: 5px solid red;
        }
        .box1{
            border-color: blue;
        }
        .box p{
            width: 80px;
            height: 80px;
            background: cyan;
            margin: 0 5px;
            float: left;
        }
        .box1 p{
            width: 80px;
            height: 80px;
            background: orange;
            margin: 0 5px;
            float: left;
        }
    </style>
</head>
<body>
    <div class="box">
        <p></p>
        <p></p>
        <p></p>
        <p></p>
    </div>
    <div class="box1">
        <p></p>
        <p></p>
        <p></p>
        <p></p>
    </div>
</body>
</html>